<template>
    请输入用户名：<input type="text" v-model="username" />
    <div>姓名是：{{ username }}</div>
    请输入密码：<input type="text" v-model.lazy="password" />
    <div>密码是：{{ password }}</div>
    请输入第一个数字：<input type="text" v-model.number="num1">
    <br>
    请输入第二个数字：<input type="text" v-model.number="num2"> 
    <br>
    <!-- <div>和是{{ num1 + num2 }}</div> -->
     <button @click="add">计算和</button>
    
     <div>{{ result }}</div>
</template>

<script setup>
//王承烨
import { ref } from 'vue';
const username = ref("");
const password = ref("");
const num1 = ref(""); 
const num2 = ref("");
let result = ref("");
function add(){
    result.value = num1.value + num2.value;
}
</script>

<style scoped>
</style>